<template>
	<view>
		<!-- <view class="u-p-30 u-flex-y-center">
			<image src="../../static/logo.png" style="width: 226rpx;height: 199rpx;border-radius: 10rpx;"></image>
			<view class="">
				<view class="u-f-28 u-m-b-26">
					物流公司：<text class="u-bold">{{info.expressName}}</text>
				</view>
				<view class="u-f-28">
					快递单号：<text>{{info.number}}</text>
				</view>
			</view>
		</view> -->
		<u-gap height="16rpx" bg-color="#F5F5FA"></u-gap>
		<view style="padding: 40rpx 30rpx;">
			<view class="u-f-36 u-bold u-m-b-50">查询结果</view>
			<view style="padding: 0 24rpx;">
				<view class="lineBox u-p-r" v-for="(item,index) in info"
					:style="{border:index+1==info.length?'none':''}">
					<view :class="index==0?'quan':'quan2'">

					</view>
					<view class="u-flex-y-center u-flex-between" :style="{color: index==0?'#007FFF':''}">
						<view class="u-flex-y-center">
							<!-- <view class="u-f-28 u-bold">运输中</view> -->
							<view class="u-f-28" :style="{color:index==0?'#101010':'#7E7E7E'}">{{item.time}}</view>
						</view>

					</view>
					<view class="u-m-t-16 u-f-32" :style="{color:index==0?'#101010':'#7E7E7E'}">
						{{item.content}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {getexpress} from '@/services/api/index'
	export default {
		data() {
			return {
				id: '',
				info: []
			}
		},
		onLoad(opt) {
			this.id = opt.id
			this.loadData()
		},
		methods: {
			formatTime(timestamp) {
			  const date = new Date(timestamp);
			  const year = date.getFullYear();
			  const month = (date.getMonth() + 1).toString().padStart(2, '0');
			  const day = date.getDate().toString().padStart(2, '0');
			  const hours = date.getHours().toString().padStart(2, '0');
			  const minutes = date.getMinutes().toString().padStart(2, '0');
			  const seconds = date.getSeconds().toString().padStart(2, '0');
			  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
			},
			async loadData() {
				let data = {
					id: this.id
				}
				const res = await getexpress(data)
				for(var i in res.data){
					 res.data[i].time =this.formatTime(res.data[i].time)
				}
				this.info = res.data
				
			}
		}
	}
</script>

<style lang="scss">
	.u-flex-between{
		justify-content: space-between;
	}
	.u-m-b-26{
		margin-bottom: 26rpx;
	}
	.u-flex-y-center{
		display: flex;
		align-items: center;
	}
	.u-f-28 {
		font-size: 28rpx;
	}
	.u-p-r{
		position: relative;
	}
	.u-p-30 {
		padding: 30rpx
	}
	.u-f-32 {
		font-size:32rpx
	}
	.u-f-36{
		font-size:36rpx
	}
	.u-bold {
		font-weight: bold;
	}
	.u-m-b-50{
		margin-bottom: 50rpx;
	}
	.lineBox {
		border-left: 1px solid #DDDFEB;
		padding-left: 32rpx;
		padding-bottom: 40rpx;

		.quan {
			width: 13rpx;
			height: 13rpx;
			background: #fabb3c;
			border-radius: 50%;
			position: absolute;
			left: -6rpx;
			top: 0rpx;
		}

		.quan2 {
			width: 13rpx;
			height: 13rpx;
			background: #DDDFEB;
			border-radius: 50%;
			position: absolute;
			left: -6rpx;
			top: 0rpx;
			box-sizing: border-box;
		}
	}
</style>